package com.tally.project.system.user.domain.vo;


import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.tally.project.system.user.domain.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @Author soul
 * @Date 2023/9/23 7:36
 * @Description
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserVo implements Serializable {

    /** 用户名称 */
    private String nickName;

    /** 用户头像 */
    private String avatar;

    /** 创建时间 */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long createTime;

    private String token;

    public UserVo(User user) {
        this.token = user.getToken();
        this.nickName = user.getNickName();
        this.avatar = user.getAvatar();
        this.createTime = user.getCreateTime();
    }
}
